package com.wb3.meta.api.core.controller;

import com.wb3.meta.api.core.service.ToysChatMsgsService;
import com.wb3.meta.api.core.vo.ReqToysChatMsgsVo;
import com.wb3.meta.common.annotation.NoPermission;
import com.wb3.meta.common.annotation.RequireAuth;
import com.wb3.meta.common.authentication.RequestHolder;
import com.wb3.meta.common.plugin.BaseResultController;
import com.wb3.meta.common.pojo.ResultT;
import com.wb3.meta.common.utils.UploadFileUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

@RestController
@Api(tags = "崽崽历史聊天接口")
@RequestMapping("base/toys/chat/msgs/")
public class ToysChatMsgsController extends BaseResultController<ReqToysChatMsgsVo> {

    @Autowired
    private ToysChatMsgsService toysChatMsgsService;
    /**
     * 列表接口
     *
     * @param reqToysChatMsgsVo
     */
    @RequireAuth
    @Override
    @ApiOperation("崽崽聊天历史记录接口")
    @GetMapping("list")
    public ResultT list(ReqToysChatMsgsVo reqToysChatMsgsVo) {

        return toysChatMsgsService.getModelMapPage(reqToysChatMsgsVo);
    }


    /**
     * 明细接口
     *
     * @param reqToysChatMsgsVo
     */
    @RequireAuth
    @Override
    @ApiOperation("详情接口")
    @GetMapping("detail")
    public ResultT detail(ReqToysChatMsgsVo reqToysChatMsgsVo) {
        return toysChatMsgsService.getModelMapById(reqToysChatMsgsVo.getId());
    }

    /**
     * 新增or更新接口
     *
     * @param reqToysChatMsgsVo
     */
    @NoPermission
    @Override
    @ApiOperation("更新接口")
    @PostMapping("update")
    public ResultT saveOrUpdate(@RequestBody ReqToysChatMsgsVo reqToysChatMsgsVo) {
        return toysChatMsgsService.saveOrUpdate(reqToysChatMsgsVo);
    }

    /**
     * 删除接口
     *
     * @param reqToysChatMsgsVo
     */
    @NoPermission
    @Override
    @ApiOperation("删除接口")
    @PostMapping("delete")
    public ResultT delete(@RequestBody ReqToysChatMsgsVo reqToysChatMsgsVo) {
        return toysChatMsgsService.delete(reqToysChatMsgsVo);
    }

}
